#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>

int main()
{
    pid_t id = fork();
    if(id == 0)
    {
        //execl("/usr/bin/ls", "ls", "-a", "-l", NULL);
        char* const argv[] = {"ls", "-a", "-l", NULL};
        //execv("/usr/bin/ls", argv);
        execvp("ls",argv);
        exit(12);
    }
    int status = 0;
    waitpid(id, &status, 0);
    if(WEXITSTATUS(status) == 12)
    {
        printf("exec error\n");
    }
    else
    {
        printf("exec success\n");
    }
    return 0;
}